/* ********************************************************************************************
*  Alvin Baldemeca
*  Tetris Project
*  Course: TCSS 305 , Alan Fowler
*  Term: Spring 2012
*  UNIVERISTY OF WASHINGTON TACOMA
*
*
**********************************************************************************************/

package gui.actions;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JTextArea;

/**
 * This class creates a message when an action is performed.
 * @author Alvin Baldemeca
 * @version 5/25/2012
 *
 */
@SuppressWarnings("serial")
public class AboutAction extends AbstractAction
{
  /**
   * The height of frame for the message to be displayed.
   */
  private static final int HEIGHT = 450;
  
  /**
   * The width of the frame for the message to be displayed.
   */
  private static final int WIDTH = 500;
  
  /**
   * The font size of the message.
   */
  private static final int FONTSIZE = 16;
  
  
  /**
   * Constructs the AboutAction.
   */
  public AboutAction()
  {
    super("About");
    putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
    putValue(Action.SELECTED_KEY, true);
  }
  

  @Override
  public void actionPerformed(final ActionEvent the_event)
  {

    final JFrame help = new JFrame();
    help.setSize(WIDTH, HEIGHT);
    help.setMinimumSize(new Dimension(WIDTH, HEIGHT));
    help.setTitle("Help : Game controls info ");
    
    final JTextArea keyboardcontroldirection = new JTextArea(
             "\n Key Controls to play Tetris \n \n" +
             "  Up arrow key -  rotates the tetris piece \n" +
             "  Down arrow key - moves the piece down \n" +
             "  Left arrow key - moves the piece to the left \n" +
             "  Right arrow key - moves the piece to the right \n" +
             "  Spacebar - drops the piece down \n" +
             "  The S key swaps the pieces \n \n" +
             "  The Backspace undo an accidental drop or sets \n" +
             "  piece back to the top of the board \n \n" +
             "  The Esc key is used for practice mode, you can\n" +
             "  move the pieces but you have to move the \n" +
             "  pieces down to practice. Pieces stay static\n" +
             "  unless its moved"
    );
    
    keyboardcontroldirection.setFont(new Font("Serif", Font.BOLD, FONTSIZE));
    keyboardcontroldirection.setLineWrap(true);
    keyboardcontroldirection.setWrapStyleWord(true);
    help.add(keyboardcontroldirection);
    help.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    help.setVisible(true);

  }
}
